{  Statement: http://acmp.ru/?main=task&id_task=45
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i,j,n:longint;
    a:array[0..9] of longint;
    
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
if n = 0 then write(10) else 
if n = 1 then write(1) else begin 
    for i := 9 downto 2 do 
                while n mod i = 0 do begin 
                        inc(a[i]);
            n := n div i; 
        end; 
    if n > 1 then write(-1) else 
                for i := 0 to 9 do 
                        for j := 1 to a[i] do 
                write(i); 
end;
end.
